package Buffered;

import java.io.*;

public class charbuffered {

    public static void main(String[] args){

        // 创建对象
        BufferedReader br = null;
        BufferedWriter bw = null;
        try {
            //使用包装流
            br = new BufferedReader(new FileReader("src/Buffered/text.txt"));
            bw = new BufferedWriter(new FileWriter("src/Buffered/永远的黑曼巴.txt"));
            // 声明一个字符串的变量
            String str = null;
            // 遍历读取写入
            while ((str = br.readLine()) != null){
                // 通过缓冲流写入
                bw.write(str);
                // 每次写入后换行
                bw.newLine();
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            //关闭流
            try {
                br.close();
                bw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
